import request from '@/utils/request'

/**
 * 获取所有角色
 * @param {page, pagesize} params
 * @returns
 */
export const getRoles = (params) => request.get('/sys/role', { params })

/**
 * 获取角色详情数据
 * @param {id} params
 * @returns
 */
export const getRoleDetail = (id) => request.get(`/sys/role/${id}`)

/**
 * 添加角色
 * @param {name, region } params
 * @returns
 */
export const addRoles = (data) => request.post(`/sys/role`, data)

/**
 * 修改角色
 * @data {companyId, description, id, name, permIds:[] } data
 * @returns
 */
export const editRoles = (data) => request.put(`/sys/role/${data.id}`, data)

/**
 * 删除角色
 * @param {} params
 * @returns
 */
export const delRoles = (id) => request.delete(`/sys/role/${id}`)

/**
 * 给角色分配权限
 * @data {id, permIds:[] } data
 * @returns
 */
export const assignPrem = (data) => request.put(`/sys/role/assignPrem`, data)

